package com.xiao.common.exception;

/**
 * @Author xiaoxiaoping
 * @Date 2020/3/10 10:07
 * @Version 1.0
 */
public class HisExecption extends RuntimeException {

    private Integer code;
    private String msg;

    public HisExecption() {}

    public HisExecption(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public HisExecption(String msg) {
        super(msg);
        this.msg = msg;
    }

    public HisExecption(String msg, Throwable cause) {
        super(msg, cause);
        this.msg = msg;
    }

    public HisExecption(Integer code, String msg, Throwable cause) {
        super(msg, cause);
        this.code = code;
        this.msg = msg;
    }

    public static HisExecption paramException(String message) {
        HisExecption baseExecption = new HisExecption(401, message);
        return baseExecption;
    }

    public static HisExecption serverErrException(String message) {
        return new HisExecption(500, message);
    }

    public static HisExecption serverErrException(String message, Exception e) {
        return new HisExecption(500, message, e);
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
